library flutter_public;

import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_public/widget/easy_refresh/easy_refresh_footer.dart';
import 'package:flutter_public/widget/easy_refresh/easy_refresh_header.dart';

import 'config/public_color.dart';
import 'config/public_text.dart';

export 'api/api.dart';
export 'api/api_interceptor.dart';
export 'api/api_method.dart';
export 'config/public_color.dart';
export 'config/public_text.dart';
export 'extension/date_time_extension.dart';
export 'extension/string_extension.dart';
export 'foundation/controller/change_text_editing_controller.dart';
export 'foundation/decoration/border_decoration.dart';
export 'foundation/decoration/linear_gradient_decoration.dart';
export 'foundation/decoration/public_box_shadow.dart';
export 'foundation/decoration/radius_decoration.dart';
export 'foundation/decoration/shadow_decoration.dart';
export 'foundation/decoration/text_field_decoration.dart';
export 'foundation/edge_insets/bottom_edge_insets.dart';
export 'foundation/edge_insets/safe_edge_insets.dart';
export 'foundation/formatter/number_text_input_formatter.dart';
export 'foundation/formatter/reg_exp_text_input_formatter.dart';
export 'foundation/localizations/public_cupertino_localizations.dart';
export 'foundation/style/bold_text_style.dart';
export 'foundation/style/medium_text_style.dart';
export 'foundation/style/normal_text_style.dart';
export 'foundation/style/public_button_style.dart';
export 'model/key_value_data_model.dart';
export 'model/key_value_model.dart';
export 'model/language.dart';
export 'model/page_status.dart';
export 'model/tab_info_model.dart';
export 'notifier/easy_refresh_notifier.dart';
export 'notifier/page_notifier.dart';
export 'notifier/page_view_notifier.dart';
export 'notifier/tab_notifier.dart';
export 'tool/cache_manager.dart';
export 'tool/debug.dart';
export 'tool/file_manager.dart';
export 'tool/native_channel.dart';
export 'tool/permission_manager.dart';
export 'tool/public_tool.dart';
export 'tool/shared_preferences_manager.dart';
export 'tool/slide_page_route.dart';
export 'widget/animation/opacity_animation.dart';
export 'widget/animation/rotate_animation.dart';
export 'widget/animation/scale_animation.dart';
export 'widget/animation/transform_animation.dart';
export 'widget/animation/translate_animation.dart';
export 'widget/bar/bottom_bar.dart';
export 'widget/bar/clear_app_bar.dart';
export 'widget/bar/home_bar.dart';
export 'widget/bar/preferred_size_tab_bar.dart';
export 'widget/bar/public_app_bar.dart';
export 'widget/bar/public_search_bar.dart';
export 'widget/bar/public_tab_bar.dart';
export 'widget/bar/status_bar.dart';
export 'widget/bar/web_app_bar.dart';
export 'widget/button/action_button.dart';
export 'widget/button/border_button.dart';
export 'widget/button/border_confirm_button.dart';
export 'widget/button/public_button.dart';
export 'widget/button/public_confirm_button.dart';
export 'widget/check_box/public_check_box.dart';
export 'widget/container/border_container.dart';
export 'widget/container/circle_container.dart';
export 'widget/container/clip_radius_container.dart';
export 'widget/container/layout_max_width_container.dart';
export 'widget/container/linear_gradient_container.dart';
export 'widget/container/radius_container.dart';
export 'widget/container/radius_shadow_container.dart';
export 'widget/container/safe_padding.dart';
export 'widget/container/separated_column.dart';
export 'widget/container/separated_row.dart';
export 'widget/container/separated_scroll_column.dart';
export 'widget/container/separated_scroll_row.dart';
export 'widget/container/shadow_container.dart';
export 'widget/container/single_child_list_view.dart';
export 'widget/container/unconstrained_row.dart';
export 'widget/dialog/public_alert_dialog.dart';
export 'widget/dialog/will_pop_dialog.dart';
export 'widget/divider/dash_line.dart';
export 'widget/divider/padding_divider.dart';
export 'widget/divider/padding_vertical_divider.dart';
export 'widget/divider/public_divider.dart';
export 'widget/divider/public_vertical_divider.dart';
export 'widget/easy_refresh/easy_refresh_footer.dart';
export 'widget/easy_refresh/easy_refresh_header.dart';
export 'widget/gesture/hide_keyboard_gesture.dart';
export 'widget/header/action_sheet_header.dart';
export 'widget/header/section_header.dart';
export 'widget/image/assets_image.dart';
export 'widget/image/circle_image.dart';
export 'widget/image/public_arrow.dart';
export 'widget/image/radius_image.dart';
export 'widget/image/tap_assets_image.dart';
export 'widget/indicator/empty_indicator.dart';
export 'widget/indicator/error_indicator.dart';
export 'widget/indicator/loading.dart';
export 'widget/indicator/loading_indicator.dart';
export 'widget/indicator/page_indicator.dart';
export 'widget/indicator/toast.dart';
export 'widget/item/check_box_item.dart';
export 'widget/item/column_item.dart';
export 'widget/item/horizontal_item.dart';
export 'widget/item/radio_item.dart';
export 'widget/item/row_item.dart';
export 'widget/item/segment_item.dart';
export 'widget/item/switch_item.dart';
export 'widget/item/text_field_item.dart';
export 'widget/item/text_select_item.dart';
export 'widget/item/text_tap_item.dart';
export 'widget/item/text_view_item.dart';
export 'widget/item/vertical_item.dart';
export 'widget/list_view/alphabet_index.dart';
export 'widget/list_view/index_bar.dart';
export 'widget/list_view/model/alphabet_index_model.dart';
export 'widget/list_view/nest_list_view.dart';
export 'widget/list_view/public_grid_view.dart';
export 'widget/picker/date_picker.dart';
export 'widget/radio/public_radio.dart';
export 'widget/scaffold/background_image_scaffold.dart';
export 'widget/scaffold/hide_keyboard_scaffold.dart';
export 'widget/scaffold/public_scaffold.dart';
export 'widget/scaffold/remove_padding_scaffold.dart';
export 'widget/search/model/search_result_model.dart';
export 'widget/search/search_view.dart';
export 'widget/segment/flexible_segment.dart';
export 'widget/segment/public_segment.dart';
export 'widget/sheet/action_sheet.dart';
export 'widget/sheet/modal_bottom_sheet.dart';
export 'widget/sheet/upload_file_action_sheet.dart';
export 'widget/show_image/show_image_page.dart';
export 'widget/show_image/show_image_view.dart';
export 'widget/subscript/number_subscript.dart';
export 'widget/subscript/text_subscript.dart';
export 'widget/tag/border_tag.dart';
export 'widget/tag/public_tag.dart';
export 'widget/text/long_press_copy_text.dart';
export 'widget/text/require_text.dart';
export 'widget/text_field/border_text_field.dart';
export 'widget/text_field/public_text_field.dart';
export 'widget/text_field/radius_text_field.dart';
export 'widget/text_view/border_text_view.dart';
export 'widget/text_view/public_text_view.dart';
export 'widget/text_view/radius_text_view.dart';
export 'widget/web_view/public_web_view.dart';
export 'widget/web_view/tool/web_view_string.dart';
export 'widget/web_view/web_view_page.dart';
export 'widget/wrapper/keep_alive_wrapper.dart';

class FlutterPublic {
  /// 是否打印日志
  static bool logEnable = kDebugMode;
  static bool printEnable = kDebugMode;

  /// APP全局导航key
  static GlobalKey<NavigatorState>? navigatorKey;

  /// 初始化
  FlutterPublic.init({
    bool? logEnable = kDebugMode,
    bool? printEnable = kDebugMode,
    GlobalKey<NavigatorState>? navigatorKey,
  }) {
    if (logEnable != null) {
      FlutterPublic.logEnable = logEnable;
    }
    if (printEnable != null) {
      FlutterPublic.printEnable = printEnable;
    }
    if (navigatorKey != null) {
      FlutterPublic.navigatorKey = navigatorKey;
    }
  }

  /// 配置颜色
  FlutterPublic.configColor({
    Color? primary,
    Color? lightPrimary,
    Color? darkText,
    Color? grayText,
    Color? lightText,
    Color? hintText,
    Color? border,
    Color? divider,
    Color? shadow,
    Color? mask,
    Color? background,
    Color? appBar,
    Color? lightAppBar,
  }) {
    if (primary != null) {
      PublicColor.primary = primary;
    }
    if (lightPrimary != null) {
      PublicColor.lightPrimary = lightPrimary;
    }
    if (darkText != null) {
      PublicColor.darkText = darkText;
    }
    if (grayText != null) {
      PublicColor.grayText = grayText;
    }
    if (lightText != null) {
      PublicColor.lightText = lightText;
    }
    if (hintText != null) {
      PublicColor.hintText = hintText;
    }
    if (border != null) {
      PublicColor.border = border;
    }
    if (divider != null) {
      PublicColor.divider = divider;
    }
    if (shadow != null) {
      PublicColor.shadow = shadow;
    }
    if (mask != null) {
      PublicColor.mask = mask;
    }
    if (background != null) {
      PublicColor.background = background;
    }
    if (appBar != null) {
      PublicColor.appBar = appBar;
    }
    if (lightAppBar != null) {
      PublicColor.lightAppBar = lightAppBar;
    }
  }

  /// 配置文字
  FlutterPublic.configText({
    String? month1,
    String? month2,
    String? month3,
    String? month4,
    String? month5,
    String? month6,
    String? month7,
    String? month8,
    String? month9,
    String? month10,
    String? month11,
    String? month12,
    String? year,
    String? day,
    String? yes,
    String? no,
    String? confirm,
    String? cancel,
    String? pleaseSelect,
    String? pleaseInput,
    String? search,
    String? goBack,
    String? noData,
    String? refresh,
    String? loadFailed,
    String? reload,
    String? refreshText,
    String? refreshReadyText,
    String? refreshingText,
    String? refreshedText,
    String? refreshFailedText,
    String? loadText,
    String? loadReadyText,
    String? loadingText,
    String? loadedText,
    String? loadFailedText,
    String? noMoreText,
    String? album,
    String? takePhoto,
    String? selectVideo,
    String? captureVideo,
    String? selectFile,
    String? viewImage,
    String? saveImage,
    String? saveSuccess,
    String? copySuccess,
    String? noStoragePermission,
    String? noPhotosVideoPermission,
    String? noCameraPermission,
    String? noMicrophonePermission,
    String? pleaseOpenPermission,
    String? toSetting,
  }) {
    if (month1 != null) {
      PublicText.month1 = month1;
    }
    if (month2 != null) {
      PublicText.month2 = month2;
    }
    if (month3 != null) {
      PublicText.month3 = month3;
    }
    if (month4 != null) {
      PublicText.month4 = month4;
    }
    if (month5 != null) {
      PublicText.month5 = month5;
    }
    if (month6 != null) {
      PublicText.month6 = month6;
    }
    if (month7 != null) {
      PublicText.month7 = month7;
    }
    if (month8 != null) {
      PublicText.month8 = month8;
    }
    if (month9 != null) {
      PublicText.month9 = month9;
    }
    if (month10 != null) {
      PublicText.month10 = month10;
    }
    if (month11 != null) {
      PublicText.month11 = month11;
    }
    if (month12 != null) {
      PublicText.month12 = month12;
    }
    if (year != null) {
      PublicText.year = year;
    }
    if (day != null) {
      PublicText.day = day;
    }

    if (yes != null) {
      PublicText.yes = yes;
    }
    if (no != null) {
      PublicText.no = no;
    }
    if (confirm != null) {
      PublicText.confirm = confirm;
    }
    if (cancel != null) {
      PublicText.cancel = cancel;
    }

    if (pleaseSelect != null) {
      PublicText.pleaseSelect = pleaseSelect;
    }
    if (pleaseInput != null) {
      PublicText.pleaseInput = pleaseInput;
    }
    if (search != null) {
      PublicText.search = search;
    }
    if (goBack != null) {
      PublicText.goBack = goBack;
    }

    if (noData != null) {
      PublicText.noData = noData;
    }
    if (refresh != null) {
      PublicText.refresh = refresh;
    }
    if (loadFailed != null) {
      PublicText.loadFailed = loadFailed;
    }
    if (reload != null) {
      PublicText.reload = reload;
    }

    if (refreshText != null) {
      PublicText.refreshText = refreshText;
    }
    if (refreshReadyText != null) {
      PublicText.refreshReadyText = refreshReadyText;
    }
    if (refreshingText != null) {
      PublicText.refreshingText = refreshingText;
    }
    if (refreshedText != null) {
      PublicText.refreshedText = refreshedText;
    }
    if (refreshFailedText != null) {
      PublicText.refreshFailedText = refreshFailedText;
    }
    if (loadText != null) {
      PublicText.loadText = loadText;
    }
    if (loadReadyText != null) {
      PublicText.loadReadyText = loadReadyText;
    }
    if (loadingText != null) {
      PublicText.loadingText = loadingText;
    }
    if (loadedText != null) {
      PublicText.loadedText = loadedText;
    }
    if (loadFailedText != null) {
      PublicText.loadFailedText = loadFailedText;
    }
    if (noMoreText != null) {
      PublicText.noMoreText = noMoreText;
    }

    if (album != null) {
      PublicText.album = album;
    }
    if (takePhoto != null) {
      PublicText.takePhoto = takePhoto;
    }
    if (selectVideo != null) {
      PublicText.selectVideo = selectVideo;
    }
    if (captureVideo != null) {
      PublicText.captureVideo = captureVideo;
    }
    if (selectFile != null) {
      PublicText.selectFile = selectFile;
    }
    if (viewImage != null) {
      PublicText.viewImage = viewImage;
    }
    if (saveImage != null) {
      PublicText.saveImage = saveImage;
    }
    if (saveSuccess != null) {
      PublicText.saveSuccess = saveSuccess;
    }
    if (copySuccess != null) {
      PublicText.copySuccess = copySuccess;
    }

    if (noStoragePermission != null) {
      PublicText.noStoragePermission = noStoragePermission;
    }
    if (noPhotosVideoPermission != null) {
      PublicText.noPhotosVideoPermission = noPhotosVideoPermission;
    }
    if (noCameraPermission != null) {
      PublicText.noCameraPermission = noCameraPermission;
    }
    if (noMicrophonePermission != null) {
      PublicText.noMicrophonePermission = noMicrophonePermission;
    }

    if (pleaseOpenPermission != null) {
      PublicText.pleaseOpenPermission = pleaseOpenPermission;
    }
    if (toSetting != null) {
      PublicText.toSetting = toSetting;
    }
    EasyRefresh.defaultHeader = EasyRefreshHeader();
    EasyRefresh.defaultFooter = EasyRefreshFooter();
  }
}
